package box10;

import java.util.ArrayList;
import java.util.stream.Stream;

public class LambdaDemo {
    public static void main(String[] args) {
        method(
                ()->{
                    //System.out.println("swimming");
                    //System.out.println("123");
                }

        );
        ArrayList<String> arrayList = new ArrayList<>();
        arrayList.add("asd");
        arrayList.add("ad");
        arrayList.add("as");
        arrayList.add("sd");
        Stream<String> stream = arrayList.stream();
        stream.filter(s -> s.startsWith("a")).forEach(s -> System.out.println(s));
        System.out.println(arrayList);//流变化了，但是原本地集合不会变
    }

    public static void method(Swim swim){
        swim.swimming();
    }
}
interface Swim{
    void swimming();
}
